import request from '@/router/axios';

//删除邮件
export const delEmail = (row) => {
  return request({
    url: '/api/blade-email/emailInfo/delete',
    method: 'post',
    headers: {
      "Content-Type": "application/json"
    },
    data: JSON.stringify(row)
  })
}
//置顶
export const fixTop = (id,type) => {
  return request({
    url: `/api/blade-email/emailInfo/fixed/${id}/${type}`,
    method: 'put'
  })
}

//彻底删除邮件
export const emptyEmail = (row) => {
  return request({
    url: '/api/blade-email/emailInfo/deleteall',
    method: 'post',
    headers: {
      "Content-Type": "application/json"
    },
    data: JSON.stringify(row)
  })
}
//清空
export const emptyAll = (row) => {
  return request({
    url: '/api/blade-email/emailInfo/clear',
    method: 'post',
    headers: {
      "Content-Type": "application/json"
    },
    data: JSON.stringify(row)
  })
}
//改为待办邮件
export const nextEmail = (row) => {
  return request({
    url: '/api/blade-email/emailInfo/wait',
    method: 'post',
    headers: {
      "Content-Type": "application/json"
    },
    data: JSON.stringify(row)
  })
}
//标记
export const labelEmail = (row) => {
  return request({
    url: '/api/blade-email/tEmailInfoAndTag',
    method: 'post',
    headers: {
      "Content-Type": "application/json"
    },
    data: JSON.stringify(row)
  })
}
//移动邮件
export const removeEmail = (row) => {
  return request({
    url: '/api/blade-email/emailInfo/move',
    method: 'post',
    headers: {
      "Content-Type": "application/json"
    },
    data: JSON.stringify(row)
  })
}
//设为已完成
export const completeEmail = (row) => {
  return request({
    url: '/api/blade-email/emailInfo/finish',
    method: 'post',
    headers: {
      "Content-Type": "application/json"
    },
    data: JSON.stringify(row)
  })
}
//已经回执
export const hasBackEmail = (row) => {
  return request({
    url: '/api/blade-email/emailInfo/receipt',
    method: 'post',
    headers: {
      "Content-Type": "application/json"
    },
    data: JSON.stringify(row)
  })
}
//取消标记
export const delLabel = (id) => {
  return request.delete(`/api/blade-email/tEmailInfoAndTag/${id}`, {params: {id: id}})
}
//删除所有标记
export const delLabelAll = (row) => {
  return request({
    url: '/api/blade-email/tEmailInfoAndTag/all',
    method: 'post',
    headers: {
      "Content-Type": "application/json"
    },
    data: JSON.stringify(row)
  })
}
//获取邮件客户对象模式数据 192.168.0.171/blade-custom/custInfo/leftEamilContent
export const getCustomerData = () => {
  return request({
    url: '/api/blade-custom/custInfo/leftEamilContent',
    method: 'get'
  })
}
//接收邮件  - 收信
export const getEmail = (emailAddress) => {
  return request({
    url: `/api/blade-email/emailInfo/${emailAddress}?frag=getEmail`,
    method: 'get'
  })
}
//查询部门树
export const getTree = () => {
  return request({
    url: '/api/blade-public/sysdept/tree',
    method: 'get'
  })
}
//分发
export const translate = (row) => {
  return request({
    url: '/api/blade-email/emailInfo/distribute',
    method: 'post',
    headers: {
      "Content-Type": "application/json"
    },
    data: JSON.stringify(row)
  })
}
//查询下属客户邮件
export const getNextEmailTree = () => {
  return request({
    url: '/api/blade-public/bladeUser/subordinate/customer',
    method: 'get'
  })
}
//搜索指定客户联系人
export const getContact = (row) => {
  return request({
    url: '/api/blade-custom/tCustLinker/list',
    method: 'get',
    params: row
  })
}
//查询产品
export const searchProduct = (row) => {
  return request({
    url: '/api/blade-product/product/list',
    method: 'post',
    headers: {
      "Content-Type": "application/json"
    },
    data: JSON.stringify(row)
  })
}
//查询产品分组
export const productTree = () => {
  return request({
    url: '/api/blade-product/tProductType/tree',
    method: 'get',
  })
}
//查询产品类型
export const productType = () => {
  return request({
    url: '/api/blade-public/dictCommon/queryDict2',
    method: 'post',
    headers: {
      "Content-Type": "application/json"
    },
    data: JSON.stringify({"evalue": "product_type"})
  })
}
//获取邮件详情
export const getMailDetail = (id) => {
  return request({
    url: `/api/blade-email/emailInfo/details/${id}`,
    method: 'get'
  })
}

//获取最近联系人
export const getRecentMan=()=>{
  return request({
    url: '/api/blade-email/emailInfo/recently/custlinker',
    method: 'get'
  })
}
//获取最近联系人
export const getEmailStream=(id)=>{
  return request({
    url: `/api/blade-email/emailInfo/forward/accessory/${id}`,
    method: 'get'
  })
}

//获取最总记录
export const getEmailIP=(id)=>{
  return request({
    url: `/api/blade-email/emailTrace/list/${id}`,
    method: 'get'
  })
}
//添加已有客户
export const addHasMan = (row) => {
  return request({
    url: '/api/blade-custom/custInfo/editCust',
    method: 'post',
    headers: {
      "Content-Type": "application/json"
    },
    data: JSON.stringify(row)
  })
}
//查询公司资料
export const getCompanyInfo=(email)=>{
  return request({
    url: `/api/blade-custom/tCustLinker/find?emailAddr=${email}`,
    method: 'get'
  })
}
